<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
	<ui:composition template="/template.xhtml">
		<ui:define name="content">
		<p:panel style="min-height: 465px;">
			<h:form id="formTbl">
				<p:dataTable id="tblPhongMay" var="phongMay"
					value="#{phongMayBean.phongMayList}" rowIndexVar="rowIndex">
					<f:facet name="header">
						<h:outputText value="Danh sách phòng máy" />
					</f:facet>
					<p:column headerText="STT" styleClass="textCenter">
						<h:outputText value="#{rowIndex+1}" />
					</p:column>
					<p:column headerText="Tên phòng máy" styleClass="textCenter">
						<h:outputText value="#{phongMay.tenPhongMay}" />
					</p:column>
					<p:column headerText="Số máy tính" styleClass="textCenter">
						<h:outputText value="#{phongMay.soMayTinh}" />
					</p:column>
					<p:column headerText="Mô tả">
						<h:outputText value="#{phongMay.moTa}" />
					</p:column>
					<p:column headerText="Trạng thái" styleClass="textCenter">
						<h:outputText
							value="#{phongMayBean.convertStatus(phongMay.status)}" />
					</p:column>
					<p:column headerText="Chỉnh sửa" styleClass="textCenter">
						<p:commandButton value="Sửa" onclick="dlg.show()"
							actionListener="#{phongMayBean.chonPhongMay(phongMay.id)}"
							update=":formDlg" icon="ui-icon-wrench" />
					</p:column>
				</p:dataTable>
			</h:form>
			</p:panel>
			<p:dialog widgetVar="dlg">
				<h:form id="formDlg">
					<h:panelGrid columns="2">
						<f:facet name="header">
							<h:outputText value="Thông tin phòng máy" />
						</f:facet>
						<h:outputText value="Tên phòng máy" />
						<p:inputText value="#{phongMayBean.phongMaySelected.tenPhongMay}" required="true" requiredMessage="Tên phòng máy không được để trống"/>
						<h:outputText value="Số máy tính" />
						<p:inputText value="#{phongMayBean.phongMaySelected.soMayTinh}" required="true" requiredMessage="Số máy tính không được để trống"/>
						<h:outputText value="Mô tả" />
						<p:inputTextarea value="#{phongMayBean.phongMaySelected.moTa}" required="true" requiredMessage="Mô tả không được để trống"/>
						<h:outputText value="Trạng thái" />
						<p:selectBooleanCheckbox
							value="#{phongMayBean.phongMaySelected.status}" />
						<p:commandButton value="Đồng ý"
							actionListener="#{phongMayBean.editPhong}" update=":menubar:growl formDlg"
							icon="ui-icon-check" />
						<p:commandButton value="Hủy" onclick="dlg.hide()"
							icon="ui-icon-close" />
					</h:panelGrid>
				</h:form>
			</p:dialog>
		</ui:define>
	</ui:composition>
</h:body>
</html>